//
//  inout-demo.swift
//  Underlying-Keywords
//
//  Created by jianbo.pei on 2023/12/13.
//

/**
 ## 来源：[inout 的实现和避坑](https://juejin.cn/post/7283025670799769654)
 */

import Foundation

struct MyStruct {
    var name: String = "iOS 新知" {
        willSet {
            print("willSet \(newValue)")
        }
        didSet {
            print("didSet \(name)")
        }
    }
}

func change(name: inout String) {
    /// 什么都不做
}

func test_inout() {
    var s = MyStruct()
    change(name: &s.name)
}

/**
 willSet iOS 新知
 didSet iOS 新知
 */

